<?php
use yii\helpers\Html;
use yii\helpers\Url;

use common\models\MktPost;
?>
<!--
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta name="keywords" content="首页关键字" />
  <meta name="description" content="首页描述" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Cache-Control" content="no-cache" />
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=2.0" />
  <meta name="apple-mobile-web-app-capable" content="yes"/>
  
  <link rel="stylesheet" href="resources/css/weui/weui.min.css">
  <link rel="stylesheet" href="resources/css/main.min.css">
  <link rel="stylesheet" href="resources/css/man.min.css">
  
  <script src="resources/js/jquery-1.10.min.js"></script>
  <script src="resources/js/jquery.touchSwipe.min.js"></script>
  <script src="resources/js/frmwebm.min.js"></script>
  <title>详情</title>
  <style>
  .weui_media_box .weui_media_title {
    font-size: 16px;color:#ef4f4f;
  }
  .weui_media_hd{
    text-align: top;
    margin-top: -30px;
	font-size:28px;
  }
  .weui_media_hd .month{
	font-size:12px;
  }
  .weui_icon_warn:before {
	color: #aeaeae
  }
  .weui_media_box{
	padding-top: 10px; padding-bottom: 10px;
  }
  .weui_media_box .weui_media_box{
	padding: 0px;
  }
  .weui_media_box.weui_media_text .weui_media_title {
    margin-bottom: 0px;
  }
  .weui_media_box.weui_media_text .weui_media_info {
    margin-top: 5px;
    font-size: 15px;
  }
  .weui_panel_ft{
    padding: 5px 15px;
  }
  .weui_article h3 {
    font-size: 15px;
  }
  .weui_article section {
    margin-bottom: 15px;
  }
  .weui_article {
    padding: 15px 15px 10px 15px;
  }
  .weui_cells:before {
    border-top: 0px;
  }
  .weui_cells:after {
    border-bottom: 0px;
  }
  .weui_panel:after {
    border-bottom: 0px;
  }
  </style>
</head>
<body style="background: #ffffff none repeat scroll 0 0;">
-->
<?php $this->params['bodyStyle'] = "background: #ffffff none repeat scroll 0 0;"; ?>
<?php $this->title = "详情"; ?>
<?php $this->registerJsFile(Yii::$app->getRequest()->baseUrl.'/resources/js/mobiscroll.min.js', ['position'=>yii\web\View::POS_HEAD, 'depends'=>['\frontend\assets\MktWapCommonAsset'] ]); ?>

<?php
$css=<<<EOD
  .weui_media_box .weui_media_title {
    font-size: 16px;color:#ef4f4f;
  }
  .weui_media_hd{
    text-align: top;
    margin-top: -30px;
	font-size:28px;
  }
  .weui_media_hd .month{
	font-size:12px;
  }
  .weui_icon_warn:before {
	color: #aeaeae
  }
  .weui_media_box{
	padding-top: 10px; padding-bottom: 10px;
  }
  .weui_media_box .weui_media_box{
	padding: 0px;
  }
  .weui_media_box.weui_media_text .weui_media_title {
    margin-bottom: 0px;
  }
  .weui_media_box.weui_media_text .weui_media_info {
    margin-top: 5px;
    font-size: 15px;
  }
  .weui_panel_ft{
    padding: 5px 15px;
  }
  .weui_article h3 {
    font-size: 15px;
  }
  .weui_article section {
    margin-bottom: 15px;
  }
  .weui_article {
    padding: 15px 15px 10px 15px;
  }
  .weui_cells:before {
    border-top: 0px;
  }
  .weui_cells:after {
    border-bottom: 0px;
  }
  .weui_panel:after {
    border-bottom: 0px;
  }
EOD;
     $this->registerCss($css);
?>

	<div class="weui_panel weui_panel_access">
		<div class="weui_panel_bd">
			<div class="weui_media_box weui_media_appmsg" href="market/woman.jsp">
				<div class="weui_media_box weui_media_text" style="width:100%;">
					<div onclick="toggleCollect(this)" id="attentionStar" style="float:right;padding-left: 5px;">

                        <?php if ($me->isMyCollect($model->id)): ?>
                          <img style="width: 15px; height: 15px;" src="resources/images/work/u278.png" class="left_btn_bg_star">  
                        <?php else: ?>
                          <img style="width: 15px; height: 15px;" src="resources/images/work/u803.png">  
                        <?php endif; ?>

                    </div>
					<div onclick="toggleCollect(this)" style="float:right;color: #999999;font-size:12px;margin-top: 2px;"><!--关注-->收藏</div>
					<div class="weui_media_title"><span><?php echo $model->shortTitle; ?></span></div>
					<div style="padding-top: 5px;padding-bottom: 5px;">
						<div class="weui_media_title" style="color: #999999;font-size: 15px;"><?php echo $model->getAreaPaths(); ?></div>

                        <?php if ($model->post_type == MktPost::POST_TYPE_JOB): ?>
                            <div style="float:right;color:red;font-size:16px;"><?php echo MktPost::getPostJobSalaryMinOption($model->job_salary_min) . ' - ' . MktPost::getPostJobSalaryMaxOption($model->job_salary_max); ?></div>
                            <ul class="weui_media_info" style="color: #999999;">
                                <li class="weui_media_info_meta"><?php echo MktPost::getPostJobExperienceOption($model->job_experience); ?></li>
                                <li class="weui_media_info_meta weui_media_info_meta_extra"><?php echo MktPost::getPostJobEducationOption($model->job_education); ?></li>
                            </ul>
                        <?php elseif ($model->post_type == MktPost::POST_TYPE_COOPERATION): ?>
                            <ul class="weui_media_info" style="color: #999999;">
                                <li class="weui_media_info_meta"><?php echo $model->shortStartTime; ?></li>
                                <li class="weui_media_info_meta weui_media_info_meta_extra"><?php echo MktPost::getPostCooperationRewardOption($model->cooperation_reward); ?><?php //echo $model->shortContent; ?></li>
                            </ul>
                        <?php else: ?>
                        <?php endif; ?>



					</div>
					<div style="color:#CCCCCC;font-size: 12px;"><span>发布于 <?php echo \common\wosotech\Util::timeago($model->update_time); ?></span></div>
				</div>
			</div>
		</div>
		<div onclick="gotoProfile(<?php echo $model->user_id; ?>); return false;" style="font-size:15px;height: 50px;line-height: 50px;" class="weui_panel_ft">
			<div style="height: 50px;width: 50px;float:left;"><img style="height: 50px;width: 50px; background-position: center center;border-radius: 100%;height: 50px;margin-right: 8px;max-height: 50px;max-width: 50px;width: 50px;" src="<?php echo \common\wosotech\Util::getWxUserHeadimgurl($model->user->theHeadimgurl, 46); ?>" alt=""></div>
			<div style="height: 50px;float:left;line-height: 50px;margin-left: 15px;color: #666666;width:60px;"><?php echo $model->user->theName; ?></div>
			<div style="height: 50px;float:left;line-height: 50px;margin-left: 15px;color: #999999;"><?php echo $model->user->theCompany . $model->user->theDuty; ?></div>
		</div>
	</div>
	
	<div style="width:100%;height:15px;background: #F7F7F7;"></div>
	<article class="weui_article" style="background: #ffffff none repeat scroll 0 0;">
    <?php echo $model->theContent; ?>
    <!--
		<h2>职位描述</h2>
		<section style="color: #999999;">
			<h3>1、参与制定公司销售目标</h3>
			<h3>2、负责辖区目标客户开发和维护工作管理</h3>
			<h3>3、管理和执行辖区市场推广工作</h3>
		</section>
		<h2>岗位要求</h2>
		<section style="color: #999999;">
			<h3>1、年龄25—40岁</h3>
			<h3>2、大专以上学历</h3>
			<h3>3、两年以上行业相关经验</h3>
		</section>
-->
	</article>
	
	<div class="weui_cells" style="background: #F7F7F7; margin-top: 0px;">
		<div onclick="tousu()" class="weui_cell" style="font-size: 13px;padding: 5px 15px;">
			<div class="weui_cell_hd"><i class="weui_icon_warn"></i></div>
			<div style="padding-left: 10px;color: #aeaeae;font-size: 10px;" class="weui_cell_bd weui_cell_primary">注意：合作请注意甄别信息真实程度。<br>如有不实，立即举报》</div>
		</div>
	</div>
	
	<div class="weui_opr_area" style="background: none repeat scroll 0px 0px rgb(255, 255, 255); margin-top: 0px; padding-top: 10px; padding-bottom: 10px;">
		<p class="weui_btn_area">
            <?php if ($model->post_type == MktPost::POST_TYPE_JOB): ?>
    			<a href="javascript:addPostResponse()" class="weui_btn weui_btn_warn">我要应聘</a>
            <?php elseif ($model->post_type == MktPost::POST_TYPE_COOPERATION): ?>
	    		<a href="javascript:addPostResponse()" class="weui_btn weui_btn_warn">我要合作</a>
            <?php else: ?>
            <?php endif; ?>
		</p>
	</div>

<script type="text/javascript">

function addPostResponse() {
    var jumpUrl = "<?php echo $this->context->getMe()->getJump() ?>";
    if (jumpUrl.length)
    {
        window.location.href = jumpUrl;
        return false;
    }

	var args = {
		'classname': '\\common\\models\\MktPostResponse',
		'funcname': 'addPostResponseAjax',
		'params': {
			'user_id' : <?php echo \common\wosotech\Util::getSessionUserId(); ?>,
			'post_id': <?php echo $model->id; ?>
		}
	};

	frmwebm.confirm({
		title:"<?php echo $model->post_type == MktPost::POST_TYPE_JOB ? '我要应聘' : '我要合作' ?>",
		content:"一天内，可以发送应聘及合作请求5次。对方有意愿合作，72小时内，将添加您为好友。",
        url: "<?= Url::to(['/wap/ajax-broker']); ?>",
		type: "GET",
		data: "args=" + JSON.stringify(args),
		successFunc: function (resp) {
			if (resp['code'] != 0) {
				frmwebm.prompt({
					title: "友情提示",
					content: resp['msg']
				});
				return;
			}

            frmwebm.toast('操作成功', 2000);
            setTimeout(function () {
                parent.history.back();
            }, 2000);
/*
			frmwebm.prompt({
				title: "提示",
				content: "操作成功"
				//reload: true
			});
*/
		},
		errorFunc: function () {
			//alert('send error');
		},
		//reload: true
		//afterClose: null,
	});

}

function toggleCollect(self) {
	var args = {
		'classname': '\\common\\models\\MktUser',
		'funcname': 'toggleCollectAjax',
		'params': {
			'user_id' : <?php echo \common\wosotech\Util::getSessionUserId(); ?>,
			'post_id': <?php echo $model->id; ?>
		}
	};

	$.ajax({
		url: "<?= Url::to(['/wap/ajax-broker']); ?>",
		type: "GET",
		cache: false,
		dataType: "json",
		data: "args=" + JSON.stringify(args),
		success: function (resp) {
			if (resp['code'] != 0) {
				alert("handle error");
				return;
			}
			clickStar(self);
		},
		error: function () {
			//alert('send error');
		}
	});
}

function tousu()
{
	window.location.href="<?php echo Url::to(['wap/work-tousu', 'id'=>$model->id]); ?>";
}

function gotoProfile(id) {
    window.location.href = "<?php echo Url::to(['market-profile']); ?>&id=" + id;
}

function clickStar(self)
{
	var img = $("#attentionStar").find("img");
	if(img.hasClass("left_btn_bg_star"))
	{
		img.removeClass("left_btn_bg_star");
		img.attr("src", "resources/images/work/u803.png")
	}
	else
	{
		img.addClass("left_btn_bg_star");
		img.attr("src", "resources/images/work/u278.png")
	}
}
</script>

<!--
</body>
</html>
-->
<?php
/*

						<div style="float:right;color:red;font-size:16px;">5k-8k</div>
						<ul class="weui_media_info" style="color: #999999;">
							<li class="weui_media_info_meta">2年工作经验</li>
							<li class="weui_media_info_meta weui_media_info_meta_extra">大专以上</li>
						</ul>


*/